package com.zd.kids.ui.activity;

import android.content.Intent;
import android.view.View;
import android.widget.TextView;

import com.blankj.utilcode.util.SpanUtils;
import com.gyf.immersionbar.BarHide;
import com.gyf.immersionbar.ImmersionBar;
import com.hyy.libray.common.BaseUtils;
import com.hyy.libray.presenter.IBasePresenter;
import com.hyy.libray.ui.activity.BaseActivity;
import com.zd.kids.R;

import butterknife.BindView;
import butterknife.OnClick;

public class WelcomeActivity extends BaseActivity {

    @BindView(R.id.tv_tips)
    TextView tvTips;
    @BindView(R.id.tv_login)
    TextView tvLogin;
    @BindView(R.id.tv_regist)
    TextView tvRegist;
    @BindView(R.id.tv_bottom_tips)
    TextView tvBottomTips;

    /**
     * 获取布局文件地址
     */
    @Override
    public int getLayoutResId() {
        return R.layout.activity_welcome;
    }

    /**
     * 初始化布局
     */
    @Override
    public void initView() {

        ImmersionBar
                .with(this)
                .fullScreen(true)
                .hideBar(BarHide.FLAG_HIDE_BAR)
                .init();


        SpanUtils.with(tvTips)
                .append(getString(R.string.welcome_come))
                .setForegroundColor(0xff696969)
                .append("\n")
                .append("GA")
                .setForegroundColor(0xffa92e37)
                .append("PSK")
                .setForegroundColor(0xff285f95)
                .append(getString(R.string.ai_gapsk_qm))
                .setForegroundColor(0xff696969)
                .create();

        SpanUtils.with(tvBottomTips)
                .append(getString(R.string.login_agree_tips))
                .setForegroundColor(0xff696969)
                .append(getString(R.string.use_protocol))
                .setForegroundColor(0xff3fada9)
                .create();
    }

    /**
     * 获取Presenter，不用MVP，可以为空
     *
     * @return
     */
    @Override
    protected IBasePresenter onBasePresenter() {
        return null;
    }


    @OnClick({R.id.tv_login, R.id.tv_regist, R.id.tv_bottom_tips})
    public void onViewClicked(View view) {
        if (BaseUtils.isFastClick()) {
            return;
        }
        Intent intent;
        switch (view.getId()) {
            case R.id.tv_login:
                intent = new Intent(this, InputLoginMobileActivity.class);
                startActivity(intent);
                break;
            case R.id.tv_regist:
                intent = new Intent(this, InputBookCodeActivity.class);
                startActivity(intent);
                break;
            case R.id.tv_bottom_tips:
                intent = new Intent(this, CommonH5Activity.class);
                intent.putExtra(CommonH5Activity.URL_PATH_KEY, "https://www.gapsk.com/t-c");
                startActivity(intent);
                break;
        }
    }

}
